package com.atguigu.springboot.dao;

import com.atguigu.springboot.entity.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author : wenchao.long
 * @date : Created in 2020/11/20 8:20 周五
 * @description :
 */
@Repository
public class DepartmentDao {

	private static final Map<Integer, Department> DEPARTMENTS;
	
	static{
		DEPARTMENTS = new HashMap<>();
		
		DEPARTMENTS.put(101, new Department(101, "D-AA"));
		DEPARTMENTS.put(102, new Department(102, "D-BB"));
		DEPARTMENTS.put(103, new Department(103, "D-CC"));
		DEPARTMENTS.put(104, new Department(104, "D-DD"));
		DEPARTMENTS.put(105, new Department(105, "D-EE"));
	}
	
	public Collection<Department> getDepartments(){
		return DEPARTMENTS.values();
	}
	
	public Department getDepartment(Integer id){
		return DEPARTMENTS.get(id);
	}
	
}
